import App from './App.vue'
// 引入router
import router from "./router";
// element-plus系统图标库
import * as Icons from "@element-plus/icons-vue";

// 基础css样式
import "@assets/styles/reset.css";
import "@assets/styles/main.css";
import '@/assets/iconfont/iconfont.css'

import { registerComponents } from "@components/index";
import HasPermission from '@/directives/HasPermission';


// 状态管理
import pinia from "@store/pinia";
import useLayoutStore from "@store/modules/layout";
const layoutStore = useLayoutStore();

const app = createApp(App);

//注册指令
app.directive("hasPermission",HasPermission);

// 注册components下封装的组件
registerComponents(app);

Object.keys(Icons).forEach((it) => {
  // 全局注册icon组件
  app.component(it, (Icons as any)[it]);
});

layoutStore.start({
  layoutId: "ltr",
});

app.use(pinia).use(router);

// 挂载
app.mount("#app");
